#ifndef __CubeMesh_h_
#define __CubeMesh_h_

#include <OgreManualObject.h>
#include <OgreSceneManager.h>

using namespace Ogre;

class CubeMesh
{
public:
	CubeMesh();
	virtual ~CubeMesh();

	SceneNode* init(String name, SceneManager *sceneMan, uint32 gridSizePower = 5);
	uint32* getVoxelGrid() {return mVoxArray;}
	void setCube(uint32 x, uint32 y, uint32 z, uint32 val);
	void updateMesh();

private:
	uint32 mGridSizePower;
	uint32 mGridSize;
	uint32 mGridXmask;
	uint32 mGridYmask;
	uint32 mGridZmask;
	uint32 mStrideY;
	uint32 mStrideZ;
	ManualObject* mManObject;
	SceneNode* mSceneNode;
	uint32* mVoxArray;
	bool mFirstUpdate;

	Entity * mEntity;
	SubMesh**  mSubMeshes;
};

#endif